package com.jefe.service.service.base;

import com.jefe.service.model.MessageTbl;
import com.jefe.service.service.MessageTblLocalService;
import com.jefe.service.service.MessageTblService;
import com.jefe.service.service.persistence.MessageTblPersistence;

import com.liferay.portal.PortalException;
import com.liferay.portal.SystemException;
import com.liferay.portal.kernel.annotation.BeanReference;
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.util.PortalUtil;

import java.util.List;


public abstract class MessageTblLocalServiceBaseImpl
    implements MessageTblLocalService {
    @BeanReference(name = "com.jefe.service.service.MessageTblLocalService.impl")
    protected MessageTblLocalService messageTblLocalService;
    @BeanReference(name = "com.jefe.service.service.MessageTblService.impl")
    protected MessageTblService messageTblService;
    @BeanReference(name = "com.jefe.service.service.persistence.MessageTblPersistence.impl")
    protected MessageTblPersistence messageTblPersistence;

    public MessageTbl addMessageTbl(MessageTbl messageTbl)
        throws SystemException {
        messageTbl.setNew(true);

        return messageTblPersistence.update(messageTbl, false);
    }

    public MessageTbl createMessageTbl(int id) {
        return messageTblPersistence.create(id);
    }

    public void deleteMessageTbl(int id)
        throws PortalException, SystemException {
        messageTblPersistence.remove(id);
    }

    public void deleteMessageTbl(MessageTbl messageTbl)
        throws SystemException {
        messageTblPersistence.remove(messageTbl);
    }

    public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
        throws SystemException {
        return messageTblPersistence.findWithDynamicQuery(dynamicQuery);
    }

    public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
        int end) throws SystemException {
        return messageTblPersistence.findWithDynamicQuery(dynamicQuery, start,
            end);
    }

    public MessageTbl getMessageTbl(int id)
        throws PortalException, SystemException {
        return messageTblPersistence.findByPrimaryKey(id);
    }

    public List<MessageTbl> getMessageTbls(int start, int end)
        throws SystemException {
        return messageTblPersistence.findAll(start, end);
    }

    public int getMessageTblsCount() throws SystemException {
        return messageTblPersistence.countAll();
    }

    public MessageTbl updateMessageTbl(MessageTbl messageTbl)
        throws SystemException {
        messageTbl.setNew(false);

        return messageTblPersistence.update(messageTbl, true);
    }

    public MessageTbl updateMessageTbl(MessageTbl messageTbl, boolean merge)
        throws SystemException {
        messageTbl.setNew(false);

        return messageTblPersistence.update(messageTbl, merge);
    }

    public MessageTblLocalService getMessageTblLocalService() {
        return messageTblLocalService;
    }

    public void setMessageTblLocalService(
        MessageTblLocalService messageTblLocalService) {
        this.messageTblLocalService = messageTblLocalService;
    }

    public MessageTblService getMessageTblService() {
        return messageTblService;
    }

    public void setMessageTblService(MessageTblService messageTblService) {
        this.messageTblService = messageTblService;
    }

    public MessageTblPersistence getMessageTblPersistence() {
        return messageTblPersistence;
    }

    public void setMessageTblPersistence(
        MessageTblPersistence messageTblPersistence) {
        this.messageTblPersistence = messageTblPersistence;
    }

    protected void runSQL(String sql) throws SystemException {
        try {
            PortalUtil.runSQL(sql);
        } catch (Exception e) {
            throw new SystemException(e);
        }
    }
}
